//
//  MTAddManagerCell.m
//  MeToo
//
//  Created by 俊松何 on 2018/9/28.
//  Copyright © 2018年 tianxie. All rights reserved.
//

#import "MTAddManagerCell.h"

@interface MTAddManagerCell()

@property (weak, nonatomic) IBOutlet UIImageView *headerImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLable;
@property (weak, nonatomic) IBOutlet UILabel *signatrLable;
@property (weak, nonatomic) IBOutlet UIButton *addButton;

@end


@implementation MTAddManagerCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.headerImageView.layer.masksToBounds = YES;
    self.headerImageView.layer.cornerRadius = 25;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

-(void)setModel:(MTUserModel *)model
{
    _model = model;
    [self.headerImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:defaultImgae];
    self.nameLable.text = model.name;
    self.signatrLable.text = model.info.signature;
    if(model.userLiveStatus.isManager)
    {
        [self.addButton setTitle:@"已经设置" forState:UIControlStateNormal];
        self.addButton.userInteractionEnabled = NO;
    }else{
        [self.addButton setTitle:@"添加为管理员" forState:UIControlStateNormal];
        self.addButton.userInteractionEnabled = YES;
    }
}

- (IBAction)addClick:(UIButton *)sender {
    
    if(self.delegate && [self.delegate respondsToSelector:@selector(addMangaerClick:)])
    {
        [self.delegate addMangaerClick:self.model];
    }
    
}




@end
